package com.pcbly.web.components.license;

import java.io.Serializable; 

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class License implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5694559768303232492L;

	private static final Log logger = LogFactory.getLog(License.class);

	LicenseData licenseData;

	public LicenseData getLicenseData() {
		return licenseData;
	}

	public void setLicenseData(LicenseData licenseData) {
		this.licenseData = licenseData;
	}

	public License() {
	}

	public byte[] getFingerprint() {
		return licenseData.getFingerprint();
	}

	public String toXML() {
		return licenseData.toXML();
	}

	public License fromXML(String xml) {
		try {
			License license = new License();
			license.setLicenseData(licenseData.fromXML(xml));
			return license;
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			throw new LicenseException("Illegal XML content!", e);
		}
	}

	public static void main(String[] args) {
	}
}
